<template>
  <div class="frame">
    <ul v-if="msgList.length > 0">
      <li v-for="item in msgList" :key="item.article_id">
        您的博客 <span>{{ item.article_title }}</span> 审核未通过，原因为：
        <span>{{ item.info }}</span>
      </li>
    </ul>
    <el-empty :image-size="200" v-else></el-empty>
    <el-pagination
      v-if="msgList.length > 0"
      background
      layout="prev, pager, next"
      :total="pageNum * 10"
      @current-change="currentPage"
      :current-page="page"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "SytemInforms",
  data() {
    return {
      //消息列表
      msgList: [],
      page: 1, //页码（默认为1）
      pageNum: 10, //每一条条数
    };
  },
  methods: {
    // 切换后页码
    currentPage(val) {
      this.page = val;
      this.dataLoad();
    },
    //消息请求接口
    dataLoad() {
      const obj = {
        pageNum: this.page,
        pageSize: this.pageNum,
        username:
          "online" +
          JSON.parse(sessionStorage.getItem("LoginMessage")).message.uid,
      };
      console.log("obj", obj);
      this.$http({
        method: "post",
        url: "websocket/reasonsForFailure",
        params: obj,
      }).then(({ data }) => {
        console.log("数据", data);
        if (data.flag) {
          this.msgList = data.data.list;
          this.pageNum = Math.ceil(data.data.total / 10);
        }
      });
    },
  },
  mounted() {
    this.dataLoad();
  },
};
</script>

<style lang="less" scoped>
ul {
  li {
    padding: 20px;
    color: rgb(59, 58, 58);
    span {
      margin: 0px 5px;
      font-weight: 700;
    }
    border-bottom: 1px solid #ccc;
  }
}
.frame {
  padding-bottom: 80px;
  position: relative;
  background-color: #fff;
}
.el-pagination {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translate(-50%);
  //   margin-top: 50px;
}
</style>